/**
 *
 * 配置信息
 *
 */
var webpack = require('webpack');
var path = require('path');
var uglifyJsPlugin = webpack.optimize.UglifyJsPlugin;
var CopyWebpackPlugin = require('copy-webpack-plugin');

module.exports = {
	entry: {
		index: ['./src/index.js'],
		vendors: [
			'react',
			'react-dom'
		]
	},
	output: {
		filename: '[name].js',
		path: path.join(__dirname, './build'),
		chunkFilename: '[name].js',
		publicPath: ''
	},
	module: {
		loaders: [
			{
				
				test: /\.js[x]?$/,
                exclude: 'node_modules',
                loader: 'babel-loader',
                query: {
                    presets:['react', 'es2015']
                }
			},
			{ test: /\.css$/,include: path.resolve(__dirname, 'src/components'), loader: 'style-loader!css-loader?modules&localIdentName=[name]__[local]-[hash:base64:5]' },
			{ test: /\.css$/,include: path.resolve(__dirname, 'src/css'), loader: 'style-loader!css-loader' },
			{ test: /\.(png|jpg|JPG|gif)$/, loader: 'url-loader?limit=8192&name=/[hash:8].[ext]' }
		]
	},
	plugins: process.env.NODE_ENV === 'dev' ? [] : [
	    new webpack.optimize.DedupePlugin(),
	    new webpack.optimize.CommonsChunkPlugin({
	        name: 'vendors',
	        filename: 'vendors.js',
	        minChunks: Infinity
	    }),
	    new webpack.optimize.OccurrenceOrderPlugin(),
	    new uglifyJsPlugin({
	        compress: {
	          warnings: false
	        }
	    }),
	  ],
    devtool: "source-map"
	// externals: {
 //    // require('data') is external and available
 //    //  on the global var data
 //    'ROOTURL': 'ROOTURL'
 //  }
}
